import { Menu, MenuItemConstructorOptions } from 'electron'

export default function createMenu(app): void {
 // Create application menu
  const menuTemplate: MenuItemConstructorOptions[] = [
    {
      label: 'File',
      submenu: [
        {
          label: 'Open',
          click: (): void => console.log('Open clicked')
        },
        {
          label: 'Close',
          click: (): void => console.log('Close clicked')
        },
        {
          label: 'Save',
          click: (): void => console.log('Save clicked')
        },
        { type: 'separator' },
        {
          label: 'Exit',
          click: (): void => app.quit(),
          accelerator: 'CmdOrCtrl+Q'
        }
      ]
    },
    {
      label: 'View',
      submenu: [
        {
          label: 'Layout',
          click: (): void => console.log('Layout clicked')
        },
        {
          label: 'Close',
          click: (): void => console.log('Close clicked')
        },
        {
          label: 'Split',
          click: (): void => console.log('Split clicked')
        },
        { type: 'separator' },
        {
          label: 'Close All',
          click: (): void => app.quit(),
          accelerator: 'CmdOrCtrl+Q'
        }
      ]
    },
    {
      label: 'Options',
      submenu: [
        {
          label: 'List',
          click: (): void => console.log('List Options clicked')
        },
        {
          label: 'Select',
          click: (): void => console.log('Select clicked')
        },
        {
          label: 'Activate',
          click: (): void => console.log('Activate clicked')
        }
      ]
    },
    {
      label: 'Help',
      submenu: [
        {
          label: 'Docmentation',
          click: (): void => console.log('Documentation clicked')
        },
        {
          label: 'Manual',
          click: (): void => console.log('Manual clicked')
        },
        { type: 'separator' },
        {
          label: 'About',
          click: (): void => console.log('About clicked')
        }
      ]
    }
  ]

  const menu = Menu.buildFromTemplate(menuTemplate)
  Menu.setApplicationMenu(menu)
  
}
